package com.team.appinfo.controller;

import com.team.appinfo.entity.DevUser;
import com.team.appinfo.service.DevUserServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * 开发者控制管理业务
 */
@Controller
public class DevUserController {
    @Autowired
    private DevUserServcie devUserServcie;

    //登录
    @RequestMapping(value = "/login")
    public String DevLogin(String username, String password, HttpSession session,String code){
        String validate = session.getAttribute("codeValidate").toString();
        DevUser login = devUserServcie.login(username, password);
        session.setAttribute("login",login);
        return "developer/appinfolist";
    }
    //推出
    @RequestMapping(value = "/logout")
    public String logout(HttpSession session){
        session.removeAttribute("login");
        return "devlogin";
    }
}
